//
//  Book.m
//  17-SandBox
//
//  Created by 李昊林 on 16/8/5.
//  Copyright © 2016年 李昊林. All rights reserved.
//

#import "Book.h"

@implementation Book
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super init];
    if (self) {
//        [aDecoder encodeObject:_bookType forKey:@"bookType"];
//        [aDecoder encodeObject:_bookName forKey:@"bookName"];
//        [aDecoder encodeObject:_bookPrice forKey:@"bookPrice"];
//        [aDecoder encodeObject:_bookAuthor forKey:@"bookAuthor"];
//        [aDecoder encodeObject:_bookAddress forKey:@"bookAddress"];

        _bookName = [aDecoder decodeObjectForKey:@"bookName"];
        _bookType = [aDecoder decodeObjectForKey:@"bookType"];
        _bookPrice = [aDecoder decodeObjectForKey:@"bookPrice"];
        _bookAuthor = [aDecoder decodeObjectForKey:@"bookAuthor"];
        _bookAddress = [aDecoder decodeObjectForKey:@"bookAddress"];
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
            [aCoder encodeObject:_bookType forKey:@"bookType"];
            [aCoder encodeObject:_bookName forKey:@"bookName"];
            [aCoder encodeObject:_bookPrice forKey:@"bookPrice"];
            [aCoder encodeObject:_bookAuthor forKey:@"bookAuthor"];
            [aCoder encodeObject:_bookAddress forKey:@"bookAddress"];
//    [aCoder setValue:_bookName forKey:@"bookName"];
//    [aCoder setValue:_bookType forKey:@"booktype"];
//    [aCoder setValue:_bookPrice forKey:@"bookPrice"];
//    [aCoder setValue:_bookAuthor forKey:@"bookAuthor"];
//    [aCoder setValue:_bookAddress forKey:@"bookAddress"];
}
@end
